package thread;

public class SyncDemo1
{
    static boolean success1 = false;
    static boolean success2 = false;
    public static void main(String[] args)
    {

        Bank bank = new Bank();
        Thread t1 = new Thread("ww")
        {
            @Override
            public void run()
            {
                success1 = bank.getMoney(20000);
            }
        };

        Thread t2 = new Thread("zz")
        {
            @Override
            public void run()
            {
                success2 = bank.getMoney(20000);
            }
        };

        t1.start();
        t2.start();

        try
        {
            Thread.sleep(100);
        } catch (InterruptedException e)
        {
            e.printStackTrace();
        }

        System.out.println("success1 = "  + success1);
        System.out.println("success2 = "  + success2);

    }
}
